package day2004;

import com.sun.corba.se.spi.activation.Server;

import java.io.*;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.Scanner;

public class fwq2 {
    public static void main(String[] args) throws IOException {
        ServerSocket a = new ServerSocket(8000);
        Socket b = a.accept();
        while(true){
            InputStream c = b.getInputStream();
            InputStreamReader d =new  InputStreamReader(c);
            BufferedReader e = new BufferedReader(d);
            String f = e.readLine();
            System.out.println(f);

            OutputStream out = b.getOutputStream();
            PrintWriter pw = new PrintWriter (out);
            String s = new Scanner(System.in).nextLine();
            pw.println(s);
            pw.flush();

        }
    }
}